#ifndef __UI_MARK_LAYOUT_H__
#define __UI_MARK_LAYOUT_H__
#include "cocos2d.h"
#include "../include/SignalSlot.h"
USING_NS_CC;
namespace fishingjoy
{
	namespace ui
	{
		class UI_MarkLayout:public CCLayer
		{
		public:
			CCSprite* numbers[5];
		public:
			UI_MarkLayout()
			{
				for(int i = 0; i < 5; ++i){
					CCSprite* n = CCSprite::create("ui/N0.png");
					n->setAnchorPoint(CCPointZero);
					addChild(n);
					n->setPositionX(i*25.5);
					n->setPositionY(0);
					numbers[i] = n;
				}
			}

			void changeNum(int num)
			{
				if(num > 99999){
					num = 99999;
				}
				if(num < 0){
					num = 0;
				}

				int g = num%10;
				changeNum(4,g);
				int s = (num/10)%10;
				changeNum(3,s);
				int b = (num/100)%10;
				changeNum(2,b);
				int q = (num/1000)%10;
				changeNum(1,q);
				int w = (num/10000)%10;
				changeNum(0,w);
			}

		private:
			void changeNum(int idx,int num)
			{
				CCSprite* p = numbers[idx];
				char buf[32];
				sprintf(buf,"ui/N%d.png",num);
				CCTexture2D* pTex = CCTextureCache::sharedTextureCache()->addImage(buf);
				p->setTexture(pTex);
			}
		};
	}
}
#endif